package com.csweimei.rentmanagementtreasure.enterprise.viewModel;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.csweimei.rentmanagementtreasure.base.AppConfig;
import com.csweimei.rentmanagementtreasure.enterprise.act.StaffDetailActivity;
import com.csweimei.rentmanagementtreasure.enterprise.act.VipActivity;
import com.csweimei.rentmanagementtreasure.http.entity.StaffListBean;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.utils.ToastUtils;

public class StaffListItemVM extends MultiItemViewModel {

    StaffManagerVM staffManagerVM;
    public StaffListItemVM(@NonNull BaseViewModel viewModel) {
        super(viewModel);
        staffManagerVM = (StaffManagerVM) viewModel;
    }


    public ObservableField<StaffListBean.DataDTO> entity = new ObservableField<>();
    public void setData(StaffListBean.DataDTO bean) {
        entity.set(bean);
    }


    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {

//            if(AppConfig.isEntVip()){
                Bundle bundle = new Bundle();
                bundle.putString(AppConfig.BUNDLE_KEY,entity.get().getUserid()+"");
                bundle.putString(AppConfig.BUNDLE_KEY2,staffManagerVM.companyID.get()+"");
                viewModel.startActivity(StaffDetailActivity.class,bundle);
//            }else {
//                ToastUtils.showShort("您还未开通企业服务，请前往购买相关服务");
//                viewModel.startActivity(VipActivity.class);
//            }

        }
    });
}
